﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TestVisioCanvas.Models
{
    /// <summary>
    /// Class that encapsulates the information needed for an invoice
    /// </summary>
    public class InvoiceModel : BaseNotify
    {
        private Wrappers.SellableShape _product;
        private int _quantity;

        /// <summary>
        /// Standard constructor, initializes the Invoice with the ManagedShape sold
        /// initializing its quantity to 1.
        /// </summary>
        /// <param name="Product">SellableShape that represents the Product to be sold</param>
        public InvoiceModel(Wrappers.SellableShape Product)
        {
            this._product = Product;
            Quantity = 1;
        }

        /// <summary>
        /// The product object of the invoice.
        /// </summary>
        public Wrappers.SellableShape Product
        {
            get { return _product; }
        }

        /// <summary>
        /// The quantity
        /// </summary>
        public int Quantity
        {
            get { return _quantity; }
            set
            {
                _quantity = value;
                OnPropertyChanged("Quantity");
                OnPropertyChanged("TotalCost");
            }
        }

        /// <summary>
        /// Total cost of the invoice for this product
        /// </summary>
        public double TotalCost
        {
            get { return _product.ProductDetails.PriceNoVAT * Quantity; }            
        }
    }
}
